Personal tools

Lua/Shared/string/trim

From JC2-MP Documentation

< Lua‎ | Shared
Jump to: navigation, search

Returns    string
Prototype    string.trim(string string)
Description    Removes any preceding or succeeding whitespaces from the string.


Examples

local inputstring = "    hi there.   What's up?     "
local trimmed = string.trim(inputstring)
 
print("\"" .. inputstring .. "\"")
--> "    hi there.   What's up?     "
 
print("\"" .. trimmed .. "\"")
--> "hi there.   What's up?"